﻿@using Kevin.Shop.Business.Service.Entity.Helper
@model  RiderShop.Mobile.Modle.CustomerModel

@section title 
{
鲜享家靓号卡
}
@section pagetitle
{
鲜享家靓号卡
}
@section header
{
    <link rel="stylesheet" href="~/Themes/RongJi/Style/base/css/order.css">
    <style>
        /*.innerwrapper, .pageHeaderMini {
            display: none;
        }*/
        .pay_list .tbox > * {
            padding: 0;
        }

        .orderSuccess dl {
            padding: 50px 10% 30px;
        }

        /*.pay_list {
            text-align: left;
            border: 1px solid #ced3d7;
            margin: 10px 0;
            border-radius: 10px;
        }*/

        .tip {
            text-align: left;
        }
    </style>
}
<div class="orderSuccess">
    <dl>
        <!-- 没有预约过卡 || 已经预约过一张卡，又选择了一张卡 -->
        @if ((Model.CurrentUserXianXiangCardNumberList != null && Model.CurrentUserXianXiangCardNumberList.Count == 0)
            || (Model.CurrentUserXianXiangCardNumberList != null && Model.CurrentUserXianXiangCardNumberList.Count == 1 && Model.SelectedXianXiangCardNumberCount == 1)
            )
        {
            <dt class="blue msg">
                <i class="glyphicon glyphicon-ok"></i>
                <p class="f16">
                    您选择的卡号是
                    <span>@Request.QueryString["cardNumber"]</span>
                    <input name="cardNumber" class="px" id="cardNumber" value="@Request.QueryString["cardNumber"]"  type="hidden">
                </p>
            </dt>
        
            <dd>
                <p>
                    <label>尊敬的：</label><span class="orange f14">@WebClientContext.Current.CurrentUser.RealName</span>
                </p>
            </dd>
            <dd></dd>
            <dd class="btnLine">
                <a href="#" id="sumbit" data-role="button" class="btn btn-success">确定</a>
            </dd>
            <dd class="btnLine">
                <a href="~/Customer/XianXiangCardSelect" id="back" data-role="button" class="btn btn-success">不满意，返回</a>
            </dd>
        } 
        else if (Model.CurrentUserXianXiangCardNumberList != null && Model.CurrentUserXianXiangCardNumberList.Count == 1 && Model.SelectedXianXiangCardNumberCount >= 2)
         {
            <dt class="red msg">
                <i class="glyphicon glyphicon-warning-sign f30"></i>
            </dt>
            <dd>
                <p>
                    您已选择过卡号<br>
                    @foreach (var item in Model.CurrentUserXianXiangCardNumberList)
                    {
                        <span class="red f18">@item.CardNumber</span><br>
                    }
                </p>
            </dd>
            <dd>每人只能预约2张卡，您仅剩下一张的权利<br>
                任何疑问请联系 400-8804-365
            </dd>
            <dd class="btnLine">
                <a href="~/Customer/XianXiangCardSelect" id="back" data-role="button" class="btn btn-success">返回</a>
            </dd>
         }
         else if (Model.CurrentUserXianXiangCardNumberList != null && Model.CurrentUserXianXiangCardNumberList.Count >= 2)
         {
            <dt class="red msg">
                <i class="glyphicon glyphicon-warning-sign f30"></i>
            </dt>
            <dd>
                <p>
                    您已选择过卡号<br>
                    @foreach (var item in Model.CurrentUserXianXiangCardNumberList)
                    {
                        <span class="red f18">@item.CardNumber</span><br>
                    }
                </p>
            </dd>
            <dd>我们的客服人员会尽快和您联系<br>
                任何疑问请联系 400-8804-365
            </dd>
            <dd class="btnLine">
                <a href="~/Customer/XianXiangCardSelect" id="back" data-role="button" class="btn btn-success">返回</a>
            </dd>
         }
    </dl>
</div>
@section footer
{
    <script type="text/javascript">
        $(document).ready(function () {
            //提交
            $("#sumbit").click(function () {
                var lock = false;
                var cardNumber = $.trim($("#cardNumber").val());

                var submitData = {
                    cardNumber: cardNumber,
                };

                if (!lock) {
                    lock = true;
                    $.ajax({
                        type: "POST",
                        data: submitData,
                        dataType: "JSON",
                        url: "/Customer/XianXiangCardNumberSumbitByAjaxRequest",
                        success: function (response) {
                            if (response.Status == false && response.ErrorMessage == 'noCardNumber') {
                                alert('您没有选择卡号！');

                                return false;
                            }
                            else if (response.Status == false) {
                                alert(response.ErrorMessage);

                                return false;
                            }
                            else if (response.Status == true && response.ErrorMessage == 'submitSuccessfully') {
                                alert('感谢您，选卡成功，我们将为您保留3天，过期自动取消，稍后我们的客服专员会联系您！');
                                $("#sumbit").hide();
                                $("#back").hide();

                                return true;
                            }
                        },
                        error: function (err) {
                            //alert('异常错误！');
                            return false;
                        }
                    })
                };
            });
        });
    </script>
}






